<div class="global-form" id="leave-feedback">
	<h3>Задать вопрос</h3>
	<?php
	$form = $this->beginWidget('CActiveForm', array(
		'id' => 'review-form-main',		
		'enableClientValidation' => true,
		'clientOptions' => array(
			'validateOnSubmit' => true,
		),
	));
	?>
	<div style="display: none">
		<?php echo $form->error($model, 'faqModelId'); ?>
		<?php echo $form->error($model, 'faqBrandId'); ?>
		<?php echo $form->error($model, 'faqCategoryId'); ?>
		<?php echo $form->error($model, 'faqTitle'); ?>
		<?php echo $form->error($model, 'faqContent'); ?>
		<?php echo $form->error($model, 'faqUserName'); ?>
	</div>
	<fieldset>
		<ul class="global-form__list uniform">
			<li>
				<div class="wrap-bg">
					<div class="select">
						<?php
						foreach (Yii::app()->params['categories'] as $cat) {
							if (!empty($cat['faqUrl'])) {
								$cats[$cat['pageId']] = $cat['pageTitle'];
							}
						}
						$ask = isset(Yii::app()->session['ask']) ? Yii::app()->session['ask'] : array();
						echo $form->dropDownList($model, 'faqCategoryId', $cats, array('empty' => 'Выбор категории',
							'ajax' => array(
								'type' => 'POST',
								'url' => '/x8/model2serv/getData',
								'data' => array(
									'id' => 'js:this.value',
									'to' => 'brand'
								),
								'update' => '.brand',
							))
						);
						?>										
					</div>   
				</div>  
			</li>
			<li>
				<div class="wrap-bg">
					<div class="select">
						<?php		
												
						echo $form->dropDownList($model, 'faqBrandId', $this->actionGetData('brand', (isset($ask['faqCategoryId']) ? $ask['faqCategoryId'] : 0), false, true), array('empty' => 'Выбор брэнда', 'class' => 'brand',
							'ajax' => array(
								'type' => 'POST',
								'url' => '/x8/model2serv/getData',
								'data' => array(
									'id' => 'js:this.value',
									'to' => 'model'
								),
								'update' => '.source',
							))
						);
						?>										
					</div> 
				</div>      
			</li>
			<li>
				<div class="wrap-bg">
					<div class="select">
						<?php
						echo $form->dropDownList($model, 'faqModelId', $this->actionGetData('model', (isset($ask['faqBrandId']) ? $ask['faqBrandId'] : 0), false, true), array('empty' => 'Выбор модели', 'class' => 'source'));
						?> 										
					</div>
				</div>    
			</li>
		</ul> 
		<div class="wrap-bg">
			<div class="type-text">
				<?php echo $form->textField($model, 'faqTitle', array('placeholder' => 'Здесь должна быть самая суть проблемы')); ?>
			</div>
		</div><br />  
		<div class="wrap-bg">
			<div class="textarea">
				<?php echo $form->textArea($model, 'faqContent', array('placeholder' => 'введите сюда пожалуйста свое решение этой проблемы', 'rows' => 10, 'cols' => 45)); ?>
			</div>
		</div> 
	</fieldset>
	<fieldset>
		<div class="type-submit-wrap">
			<div class="type-submit-wrap__inner">
				<div class="type-submit">
					<?php echo CHtml::submitButton('Отправить отзыв'); ?>
				</div>
			</div>    
		</div>    
	</fieldset>
	<?php $this->endWidget(); ?>
</div>  

<?php if (Yii::app()->user->isGuest) echo '<script>
$(function(){
	$(document).ready(function(){
		$(".user-panel__login a").trigger("click");
	});
});
</script>'; ?>